package work.timejay.common;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

/**
 * @className:SuperPage.java
 * @author:王文杰
 * @version:1.0.0
 * @description:分页父类
 * @createTime 2023年11月24日 11:08:00
 */
@Data
public class SuperPage<T> {
    /**
     * 每页展示数量
     */
    private Integer pageSize;

    /**
     * 页码
     */
    private Integer pageNum;

    /**
     * 排序字段 asc desc
     */
    private String desc;

    public Integer getPageSize() {
        if (this.pageSize == null || this.pageSize == 0) {
            this.pageSize = 10;
        }
        return pageSize;
    }

    public Integer getPageNum() {
        if (this.pageNum == null || this.pageNum == 0) {
            this.pageNum = 1;
        }
        return pageNum;
    }

    public Page<T> getPage() {
        return new Page(getPageNum(),getPageSize());
    }
}
